package javaCode.chapter04.练习;

import java.util.Scanner;

public class nextedIfExercise01 {

    public static void main(String[] args) {
        /*
        应用案例
        出票系统：根据淡旺季的月份和年龄，打印票价
        4_10 旺季：
                成人(18-60) :60
                儿童 (<18) :半价
                老人(>60) :1/3

        淡季：
            成人:40
            其他:20

        */
        Scanner myScanner = new Scanner(System.in);
        System.out.println("请输入月份:");
        int month=myScanner.nextInt();
        if (month>=4 && month<=10){
            System.out.println("季节为旺季!");
            System.out.println("请输入年龄:");
            int age = myScanner.nextInt();
            if (age>=18 && age<=60){
                System.out.println("年龄="+age+" 60元");
            }else if (age>18){
                System.out.println("年龄="+age+ "30元");
            }else{
                System.out.println("年龄="+age+" 20元");
            }
        }else{
            System.out.println("季节为淡季!");
            System.out.println("请输入年龄:");
            int age = myScanner.nextInt();
            if (age>=18 && age<=60){
                System.out.println("年龄="+age+" 40元");
            }else{
                System.out.println("年龄="+age+" 20元");
            }
        }
    }
}
